|
|
|
|
|
|
|
Learn the three modes of Visual Basic |
|
|
|
|
|
|
|
|
Learn to invoke the debugger |
|
|
|
|
|
|
|
|
Learn to watch variables and set breakpoints |
|
|
|
|
|
|
|
|
Learn to control and view the execution path of your source code in the debugger |
|
|
|
|
|
|
|
|
Learn to use the Immediate window |
|
|
|
|
|
|
|
|
Sample Project File: \Chapter16\Debugging.vbp |
|
|
|
|
|
|
|
|
Three Modes of Visual Basic |
|
|
|
|
|
|
|
|
You can work in one of three modes in Visual Basic: design, run, or break. Each mode has a specific function, and knowing which mode youre in is very important. |
|
|
|
|
|
|
|
|
Lets take a look at the three different modes youll be working in. First, in design mode you build your user interface and write the source code. Next, in run mode you run your application. Finally, in break mode you can edit code, test variables, reset values, and step through your source code line by line. |
|
|
|
|
|
|
|
|
You can tell which mode youre in by looking at the Visual Basic title bar. After the name of the project, youll see Microsoft Visual Basic followed by [design], [run], or [break]. Get used to looking at the title bar for information on which mode youre currently in, because there are things you can and cant do in each mode. |
|
|
|
|
|
|
|
|
If you right-click the toolbar area of the Visual Basic IDE, you can select the Debug toolbar (see Figure 16.1). |
|
|
|
|
|
|
|
|
Figure 16.1
The Debug toolbar. |
|
|
|
|
|